//编写程序，将来自一个文件中的行保存在一个vector<string>中。然后使用一个istringstream从vector读取数据元素，每次读取一个单词。
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
#include<sstream>

using namespace std;
int main()
{
	ifstream in("iostxt.txt");
	if (!in)
	{
		cerr << "there is a problem" << endl;
		return -1;
	}
	string line=0;
	vector<string> words;
	while (getline(in, line))
	{
		words.push_back(line);
	}
	in.close();
	vector<string>::const_iterator it = words.begin();
	while (it != words.end())
	{
		istringstream line_str(*it);
		string word;
		while (line_str >> word)
			cout << word << " " << endl;
		++it;
	}
	return 0;
}